/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
/**
 * File     Particle.java
 * Package  robocup.component.filters
 * Project  Robocup
 * Date     Jun 19, 2005
 * Web      www.dai-labor.de
 * 
 * @author  Grzegorz Lehmann
 */
package robocup.component.filters;

import robocup.component.geometry.Vektor;

/**
 * <code>Particle</code>
 * 
 * @author Grzegorz Lehmann
 */
public class Particle extends Vektor {
	private double probability;

	private final double distance;

	/**
	 * <code>Particle</code> constructor
	 * 
	 * @param v
	 * @param p
	 * @param dist
	 */
	public Particle(Vektor v, double p, double dist) {
		super(Vektor.XY, v.x, v.y);
		this.probability = p;
		this.distance = dist;
	}

	/**
	 * <code>getProbability</code> getter
	 * 
	 * @return returns the probability.
	 */
	public final double getProbability() {
		return this.probability;
	}

	/**
	 * <code>getDistance</code> getter
	 * 
	 * @return returns the distance.
	 */
	public final double getDistance() {
		return this.distance;
	}

	/**
	 * <code>toString</code>
	 * 
	 * @see robocup.component.geometry.Vektor#toString()
	 */
	@Override
	public String toString() {
		return super.toString() + ", belief: " + this.probability;
	}

	/**
	 * <code>scale</code>
	 * 
	 * @param scale
	 */
	public final void scale(double scale) {
		if (scale > 0) {
			this.probability /= scale;
		}
	}
}
